package com.mz.ozy.mvp.presenter;

import android.content.Context;


import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.AgreementBean;
import com.mz.ozy.mvp.model.AgreementModel;
import com.mz.ozy.mvp.view.AgreementContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import okhttp3.ResponseBody;


public class AgreementPresenter extends BasePresenterImpl<AgreementContract.View> implements AgreementContract.Presenter {

    private AgreementModel mModel;

    public AgreementPresenter() {
        mModel = new AgreementModel();
    }

    @Override
    public void onAgreement(Context context, String name) {
        mModel.onAgreement(context,name)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<AgreementBean>(mView) {

                    @Override
                    public void onSuccesss(AgreementBean bean) {
                        mView.onAgreementSuccess(bean);
                    }
                });
    }
}
